﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Fibonacci
{
    class Program
    {
        static void Main(string[] args)
        {
            //for (int i = 0; i < 100; i++)
            //{
            //    Console.WriteLine(i + ": " + FibRecursive(i));
            //    //Console.WriteLine(FibIterative(i)); 
            //}
            FibRecursive(10, true);
            Console.Read();
        }

        static void PrintFib(int n)
        {
            for (int i = 0; i < n; i++)
            {
                Console.Write(FibRecursive(i, true));
            }
            Console.Write('\n');
        }

        static int FibRecursive(int n, bool print = false)
        {
            Console.WriteLine("Fib(" + n + ")");
            if (n > 1)
            {
                return FibRecursive(n - 1) + FibRecursive(n - 2); 
            }
            else
            {
                return 1;
            }
        }

        static int FibIterative(int n)
        {
            int a0, a1, a2;
            a0 = a1 = a2 = 1;

            for (int i = 1; i < n; i++)
            {                
                a0 = a1;
                a1 = a2;
                a2 = a1 + a0;
            }
            return a2;
        }
    }
}
